package edu.uob;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class DatabaseCreator {
    public static String createDatabase(String dbName) {
        Path directoryPath = Paths.get(".", "databases", dbName);
        if (Files.exists(directoryPath)) {
            return "[ERROR]: Database " + dbName + " already exists!";
        }

        try {
            Files.createDirectories(directoryPath);
            return "[OK]";
        } catch (IOException e) {
            return "[ERROR]: Failed to create database " + dbName + "!";
        }
    }
}
